<include file="Public/header"/>
<include file="Public/menu"/>
<style type="text/css">
.edit-batch-list .ebatch-name{
	width:480px;
}
</style>
<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            营销
            <small>管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="{:U('DiscountCoupon/index')}"><i class="fa fa-dashboard"></i> 营销</a></li>
            <li class="active">优惠券</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">修改优惠券</h3>

                        <div class="box-tools">

                            <div class="btn-group pull-right" style="margin-right: 10px">
                                <a href="/Qgs/DiscountCoupon/index" class="btn btn-sm btn-default"><i
                                        class="fa fa-list"></i>&nbsp;优惠券列表</a>
                            </div>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form id="form" action="/Qgs/DiscountCoupon/postUpdate" method="post" class="form-horizontal" onSubmit="return checkSubmit();">
                        <input value="<?php echo $_GET['id'];?>" type="hidden" name="id" />
                        <div class="box-body">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">优惠卷名称</label>
                                <div class="col-sm-6">
                                    <div class="no-margin">
                                        <input name="name" type="text" class="form-control" value="{$msg.name}">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">优惠卷说明</label>
                                <div class="col-sm-6">
                                    <div class="no-margin">
                                        <textarea name="description" class="form-control">{$msg.description}</textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">排他功能</label>
                                <div class="col-sm-6">
                                    <div class="no-margin">
                                        否<input name="paita" value="0" type="radio"
                                        <if condition="$msg['paita'] eq '0'">checked</if>
                                        >
                                        是 <input name="paita" value="1" type="radio"
                                        <if condition="$msg['paita'] eq '1'">checked</if>
                                        >
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">排序</label>
                                <div class="col-sm-6">
                                    <div class="no-margin">
                                        <input name="sort" class="form-control ajax-sort"  value="{$msg.sort}" type="text" placeholder="越小越靠前">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">优惠类型</label>
                                <div class="col-sm-6">
                                    <div class="no-margin">
                                        <select id="yh-type" name="type" class="form-control" onchange="showRelativeArea(this)">
                                            <option value="1" <if condition="$msg['type'] eq '1'">selected="selected"</if> >1：现金券</option>
                                            <option value="2" <if condition="$msg['type'] eq '2'">selected="selected"</if> >2：订单优惠券</option>
                                            <option value="3" <if condition="$msg['type'] eq '3'">selected="selected"</if> >3：商品优惠券</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group  youhui_goods-area" >
                                <label class="col-sm-2 control-label set_goods_name_values">设置<if condition='$msg["type"] eq 1 or $msg["type"] eq 2'>排除 </if>商品</label>
                                <div class="col-sm-6">
                                    <div class="no-margin">
                                        <button type="button" class="btn btn-default pull-left" id="daterange-btn">
                                            <span>
                                              <i class="fa fa-calendar"></i> 点击添加商品
                                            </span>
                                            <i class="fa fa-caret-down"></i>
                                        </button>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group  youhui_goods-area" >
                                <div class="col-sm-offset-2 col-sm-6">
                                    <div class="box box-primary" style="width:580px;">
                                        <!-- /.box-header -->
                                        <div class="box-body">
                                            <ul class="todo-list ui-sortable edit-batch-list">
                                                <?php if (!empty($products)){
                                                        foreach($products as $v) {
                                                    ?>
                                                <li>				
                                                    <input type="hidden" name="goods_id[]" value="<?php echo $v['store_pid'];?>">
                                                    <?php $v_tit = $v['name'] . $v['spec_info'];?>       
                                                    <a href="javascript:;" title="<?php echo $v_tit; ?>" class="text ebatch-name"><?php echo $v_tit; ?></a>
                                                    <div class="tools">
                                                        <i class="fa fa-trash-o icondel" data-id="<?php echo $v['store_pid'];?>" onclick="delGoodsItem(this)"></i>
                                                    </div>
                                                </li>
                                                <?php } } ?>
                                            </ul>
                                        </div>                                        
                                        <!-- /.box-body -->
                                    </div>
                                </div>
                            </div>
                            <div class="form-group youhui_goods-area" >
                                <label class="col-sm-2 control-label">&nbsp;&nbsp;</label>
                                <div class="col-sm-6">
                                    <div class="input-group">
                                        <input id="yc-goods-ids" name="goods_id_array" value="{$msg.goods_id_array}" type="hidden"/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group set-goods-area" <if condition='$msg["type"] eq 3'>style="display:block"  <else/> style="display:none" </if> >
                                <label class="col-sm-2 control-label">优惠</label>
                                <div class="col-sm-6">
                                    <div class="input-group">
                                        <input id="goods_price" name="goods_price" class="form-control" value="{$msg.goods_price}"/>
                                        <span class="input-group-addon">元</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group money-price-area" <if condition='$msg["type"] eq 1'>style="display:block"  <else/> style="display:none" </if> >
                                <label class="col-sm-2 control-label">现金优惠券</label>
                                <div class="col-sm-6">
                                    <div class="input-group">
                                        <input id="money_price" name="money_price" class="form-control" value="{$msg.money_price}"/>
                                        <span class="input-group-addon">元</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group order-price-area" <if condition='$msg["type"] eq 2'>style="display:block"  <else/> style="display:none" </if> >
                                <label class="col-sm-2 control-label">订单金额满</label>
                                <div class="col-sm-6">
                                    <div class="input-group">
                                        <input id="man_price" name="man_price" class="form-control" value="{$msg.man_price}"/>
                                        <span class="input-group-addon">元</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group order-price-area" <if condition='$msg["type"] eq 2'>style="display:block"  <else/> style="display:none" </if> >
                                <label class="col-sm-2 control-label">优惠</label>
                                <div class="col-sm-6">
                                    <div class="input-group">
                                        <input id="youhui_price" name="youhui_price" class="form-control" value="{$msg.youhui_price}"/>
                                        <span class="input-group-addon">元</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">开始时间</label>
                                <div class="col-sm-6">
                                    <div class="input-group">
                                        <input id="start_time" class="form-control" type="text" name="start_time" value="{$msg.start_time}" readonly>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">结束时间</label>
                                <div class="col-sm-6">
                                    <div class="input-group">
                                        <input id="end_time" class="form-control" type="text" name="end_time" value="{$msg.end_time}" readonly>
                                    </div>
                                </div>
                            </div>
                    </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <div class="col-sm-2"></div>
                            <div class="col-sm-6">
                                <div class="btn-group pull-right">
                                     <button type="submit"  class="btn btn-info">提交</button>
                                </div>
                            </div>
                        </div>
                   </form>
				</div>
			</div>
		</div>
	</section>
</div>


<!-- 底部 -->
<include file="Public/common_footer"/>
<script src="/Public/layer/layer.js"></script>
<link rel="stylesheet" href="/Public/admin/jedate/jedate.css" />
<script src="/Public/admin/jedate/jedate.js"></script>
<script type="text/javascript">
var yx_product_url = "{:U('DiscountCoupon/productAdd','' , '')}";
</script>
<script type="text/javascript" src="/Public/admin/js/admin.yx.discount.js"></script>